<extend name="Public/base"/>

<block name="body">
	<div class="main-title">
		<h2>{$coupon.title}优惠券明细</h2>
	</div>

	<div class="cf">
		<a class="btn" href="__URL__/detaillist">全部</a>
		<a class="btn" href="{:U('Coupon/detaillist',array('is_ply'=>0))}">未使用</a>
		<a class="btn" href="{:U('Coupon/detaillist',array('is_ply'=>1))}">已使用</a>
		<a class="btn" href="{:U('Coupon/adddetail')}">新增明细</a>
		<!--<button class="btn ajax-post confirm" target-form="ids" url="{:U("del")}">删除</button>-->
	</div>

	<div class="data-table table-striped">
		<table>
			<thead>
				<tr>
					<th class="row-selected">
						<input class="checkbox check-all" type="checkbox">
					</th>
					<th>ID</th>
					<th>卡号</th>
					<th>是否领取</th>
					<th>领取用户id</th>
					<th>领取用户姓名</th>
					<th>领取时间</th>
					<th>是否使用</th>
					<th>使用时间</th>
					<th>操作</th>
				</tr>
			</thead>
			<tbody>
				<notempty name="list">
				<volist name="list" id="item">
					<tr>
						<td><input class="ids row-selected" type="checkbox" name="ids[]" id="" value="{$item['id']}"> </td>
						<td>{$item.id}&nbsp;</td>
						<td>{$item.sn}&nbsp;</td>
						<td>
							<if condition="$item.user_id gt 0">已领取<else/>未领取</if>
						</td>
						<td><if condition="$item.user_id gt 0">{$item.user_id}</if></td>
						<td><if condition="$item.user_id gt 0">{$item.name}</if></td>
						<td><if condition="$item.addtime neq ''">{$item.addtime|date='Y-m-d',###}</if></td>
                        <td>{$plyarr[$item['is_ply']]}</td>
                        <td>
						<if condition="$item.plytime gt 0">
						{$item.plytime|date='Y-m-d H:i:s',###}
						</if>
						</td>
						<td>
						<a class="confirm ajax-get" title="删除" href="__URL__/deldetail/id/{$item.id}">删除</a>
						</td>
					</tr>
				</volist>
				<else/>
				<td colspan="6" class="text-center"> aOh! 暂时还没有内容! </td>
				</notempty>
			</tbody>
		</table>
	</div>
		<div class="page">
        {$page}
		</div>
</block>

<block name="script">
<script type="text/javascript">
    $(function() {
    	//点击排序
    	$('.list_sort').click(function(){
    		var url = $(this).attr('url');
    		var ids = $('.ids:checked');
    		var param = '';
    		if(ids.length > 0){
    			var str = new Array();
    			ids.each(function(){
    				str.push($(this).val());
    			});
    			param = str.join(',');
    		}

    		if(url != undefined && url != ''){
    			window.location.href = url + '/ids/' + param;
    		}
    	});
    });
</script>
</block>